/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ssau.berlin.jsf.beans;

import javax.faces.context.FacesContext;
import ru.ssau.berlin.jsf.util.FacesApplication;

/**
 *
 * @author Caesar
 */
public class LocaleController {

    private static final String LOCALE_PARAM = "locale";

    private FacesApplication application = FacesApplication.getInstance();

    private String locale;

    public LocaleController() {
        locale = FacesContext.getCurrentInstance().getApplication()
                .getDefaultLocale().toString();
    }

    public String getLocale() {
        return locale;
    }

    public void setLocale(String locale) {
        this.locale = locale;
    }

    public String setLocale() {
        locale = application.getRequestParameter(LOCALE_PARAM);
        return application.getNavigator().stayHere();
    }

}
